package com.google.code.stalkernet.node;

import com.google.code.stalkernet.node.event.NodeListener;
import com.google.code.stalkernet.peer.Peer;

/**
 * Stalker.Net node.
 *
 * @author Mikhail Vladimirov
 */
public interface Node
{
    /**
     * Get ID of the node.
     *
     * @return {@link NodeID} object
     */
    public NodeID getID ();

    /**
     * Add listener to be notified about node-related events.
     *
     * @param nodeListener listener to be notified about node-related events
     */
    public void addNodeListener (NodeListener nodeListener);

    /**
     * Add listener notified about node-related events.
     *
     * @param nodeListener listener to be removed
     */
    public void removeNodeListener (NodeListener nodeListener);

    /**
     * Add peer to the node.
     *
     * @param peer peer to be added
     */
    public void addPeer (Peer peer);

    /**
     * Remove peer from the node.
     *
     * @param peer peer to be removed
     */
    public void removePeer (Peer peer);

    /**
     * Get all peers of the node.
     *
     * @return an array of {@link Peer} objects
     */
    public Peer [] getAllPeers ();
}
